﻿using System;
using System.Collections.Generic;

namespace CompactMapper.Orm.UnitOfWork.Mappings
{
    public static class AbstractKeyFactory
    {
        private static readonly Dictionary<String, object> KeyFactories = new Dictionary<String, object>
                                                                   {
                                                                       {typeof (long).Name, new LongKeyFactory()},
                                                                       {typeof (Guid).Name, new GuidKeyFactory()},
                                                                   };

        public static IKeyFactory For<T>()
        {
            return For(typeof(T));
        }
        public static IKeyFactory For(Type type)
        {
            return (IKeyFactory)KeyFactories[type.Name];
        }
        public static IKeyFactory For(String typeName)
        {
            return (IKeyFactory)KeyFactories[typeName];
        }

    }
}